package com.deimos.sps;

import org.apache.axiom.om.OMElement;
import org.apache.axis2.util.XMLUtils;
import org.vast.ows.OWSException;
import org.vast.ows.sps.DescribeTaskingRequest;
import org.vast.xml.DOMHelper;
import org.vast.xml.DOMHelperException;
import org.w3c.dom.Element;

import com.deimos.dataBase.Sensor;


public class DescribeTasking {
    Sensor sensor = null;

    public DescribeTasking(DescribeTaskingRequest request, Sensor sensor) {
	this.sensor = sensor;
    }

    public OMElement buildResponse() throws OWSException {
	OMElement response = null;
	try {
	    // get URL of a local file containing this
	    // DescribeTaskingResponse XML
	    String responseUrl = sensor.getDescribeTasking();
	    DOMHelper domResponse = new DOMHelper(responseUrl, false);
	    Element eltResponse = domResponse.getRootElement();
	    response = XMLUtils.toOM(eltResponse);
	} catch (DOMHelperException e) {
	    e.printStackTrace();
	} catch (Exception e) {
	    e.printStackTrace();
	}

	return response;
    }
}
